# CXX = g++
# TARGET = main
# SRC = $(wildcard *.cpp)
# OBJ = $(patsubst %.cpp, %.o, $(SRC))

# CXXFLAGS = -c -Wall

# $(TARGET):$(OBJ)
# 	$(CXX) -o $@ $^ 

# %.o:%.cpp
# 	$(CXX) $(CXXFLAGS) $< -o $@

# .PHONY:clean
# clean:
# 	rm -f $(BUILD_DIR)/*.o $(TARGET)

.PHONY: xx

"":
	if [ -d "build" ]; then \
		cd build && make -j4; \
	else \
		mkdir build; \
		cd build && cmake -DCMAKE_CXX_COMPILER:FILEPATH=$(shell which g++) -DCMAKE_C_COMPILER:FILEPATH=$(shell which gcc) ..; \
	fi

%:
	if [ -d "build" ]; then \
		cd build && make $@; \
	else \
		mkdir build; \
		cd build && cmake -DCMAKE_CXX_COMPILER:FILEPATH=$(shell which g++) -DCMAKE_C_COMPILER:FILEPATH=$(shell which gcc) $@ ..; \
	fi
